package com.oa.juint;


import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

import com.oa.ServiceImp.RoleUserServiceImp;
import com.oa.entity.RoleUser;


@RunWith(SpringJUnit4ClassRunner.class)  
@ContextConfiguration(locations = {"classpath:spring-system-config.xml"})  
@Transactional  
@TransactionConfiguration(transactionManager="H4TxManager",defaultRollback=false)
public class RoleUserTest {
	
	@Autowired  
	private RoleUserServiceImp userService; 
	
	@Test  
	 public void addUser(){
		 RoleUser user = new RoleUser();
	     user.setRole_id(1);
	     user.setRole_name("ceshi");
		 userService.saveUser(user); 
	          
	    }
	
	@Test
	public void find(){
		List<RoleUser> list = userService.find("from RoleUser");
		for (RoleUser roleUser : list) {
			System.out.println(roleUser.getRole_name());
		}
		
	}

}
